from flask import Flask
from flask_cors import CORS
from flask_migrate import Migrate
from model.models import db
from view.user import user_bp
from utils.cache import cache

def create_flask_app(config):
    app = Flask(__name__)
    app.config.from_object(config)

    CORS(app)
    db.init_app(app)
    Migrate(app, db)

    cache.init_app(app)
    app.register_blueprint(user_bp)

    return app
